Skip to content

feat: include developer orgs with Runtime feature in console org commands#257

Open
pru55e11 wants to merge 3 commits intomasterfrom
include-developer-orgs
Open

feat: include developer orgs with Runtime feature in console org commands#257
pru55e11 wants to merge 3 commits intomasterfrom
include-developer-orgs

Conversation

@pru55e11
Copy link
Copy Markdown
Contributor

@pru55e11 pru55e11 commented May 6, 2026

Summary

aio console org list and aio console org select previously filtered organizations down to type: 'entp' only. App Builder trial orgs are provisioned as type: 'developer', so trial users could not see or select their own org from the CLI and had to fall back to downloading a workspace.json from the Console UI.

This PR keeps enterprise orgs as-is and additionally surfaces developer orgs that have the RUNTIME feature enabled — the same flag the Developer Console uses to gate App Builder access on single-user orgs. Feature flags are looked up per-org from /console/api/organizations/{orgId}/features, with the base URL derived from the active CLI environment (prod/stage), matching the existing OPEN_URLS config.

Changes

  • src/config.js: add ORG_TYPE_DEVELOPER and ORG_FEATURE_RUNTIME constants
  • src/commands/console/index.js: add getOrgFeatures, hasRuntimeFeature, and getSelectableOrgs helpers on the base ConsoleCommand
  • src/commands/console/org/list.js: route the org list through getSelectableOrgs
  • src/commands/console/org/select.js: route interactive org selection through getSelectableOrgs
  • test/__fixtures__/org/list.{json,txt,yml}: add a developer-type org row
  • test/commands/console/index.test.js: cover the three new helpers, including non-OK feature responses, an unknown-env URL fallback, and a feature-lookup failure
  • test/commands/console/org/{list,select}.test.js: stub fetch for the features endpoint and add coverage for the developer-org path

Verified

  • npm test (full suite, 100% coverage retained)
  • npm run lint (no new warnings)
  • Live smoke test against stage with AIO_CLI_ENV=stage ./bin/run console org list --json — the trial developer org now appears alongside enterprise orgs

Test plan

  • CI: npm test passes
  • CI: lint passes
  • Manual: aio console org list against a stage trial account shows the developer org with RUNTIME feature
  • Manual: aio console org list against a developer org without the RUNTIME feature does not surface it
  • Manual: aio console org select interactive prompt includes the same set of orgs as org list

…ands

`aio console org list` and `aio console org select` previously filtered
out every organization that was not `entp` (enterprise). App Builder
trial orgs are provisioned with `type: developer`, so trial users could
not see or select their own org from the CLI and were forced to download
a workspace.json from the Console UI as a workaround.

This change keeps enterprise orgs as-is and additionally includes
`developer` orgs that have the `RUNTIME` feature enabled, which is the
flag the Console sets on App Builder-eligible single-user orgs. The
feature flags are fetched per-org from
`/console/api/organizations/{orgId}/features`, with the base URL derived
from the active CLI environment (prod / stage).

- add `getOrgFeatures`, `hasRuntimeFeature`, and `getSelectableOrgs`
  helpers on the base `ConsoleCommand`
- route `org list` and `org select` through `getSelectableOrgs`
- add unit tests + fixtures covering the developer-org path,
  non-OK feature responses, and unknown-env URL fallback
@codecov
Copy link
Copy Markdown

codecov Bot commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pru55e11
Copy link
Copy Markdown
Contributor Author

pru55e11 commented May 6, 2026

/review

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 PR Reviewer

The diff introduces developer org support by filtering orgs based on a Runtime feature flag fetched from an external API. The implementation is clean and well-tested. A few minor issues worth noting: the URL construction via string replacement is fragile, network errors in getOrgFeatures are silently swallowed at the HTTP level (non-ok responses return [] without logging), and sequential awaits in getSelectableOrgs could be parallelized for performance.

📝 3 suggestion(s) - Please review inline comments below.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

Comment thread src/commands/console/index.js
Comment thread src/commands/console/index.js
Comment thread src/commands/console/index.js Outdated
- add CONSOLE_API_URLS constant in src/config.js so getOrgFeatures
  reads the base URL directly instead of stripping '/console/projects'
  off OPEN_URLS
- log non-ok feature responses at debug level so failures (401/403/500)
  are diagnosable instead of silently producing an empty list
- parallelize the per-org RUNTIME feature checks in getSelectableOrgs
  with Promise.all so list/select latency does not scale linearly with
  the number of developer orgs
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 PR Reviewer

All three previously raised suggestions have been addressed: CONSOLE_API_URLS is now stored directly in config (no fragile string replacement), non-ok HTTP responses are logged at debug level before returning [], and org feature checks are parallelized with Promise.all. The implementation is clean, well-tested, and follows existing patterns. No significant issues remain.

LGTM! This PR looks good to merge.


💡 How to re-trigger

Comment /review or /pr-reviewer on this PR

@github-actions github-actions Bot dismissed their stale review May 6, 2026 23:16

Superseded by new review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants